package cn.sumpu.app.guoguojie.dao;

import java.util.List;
import java.util.Map;

import cn.sumpu.app.guoguojie.domain.Comment;
import cn.sumpu.app.guoguojie.domain.Doing;
import cn.sumpu.app.guoguojie.domain.DoingAudit;
import cn.sumpu.app.guoguojie.domain.DoingPicture;
import cn.sumpu.app.guoguojie.domain.DoingProduct;
import cn.sumpu.app.guoguojie.domain.DoingProductAudit;
import cn.sumpu.app.guoguojie.domain.DoingProductTime;
import cn.sumpu.app.guoguojie.domain.DoingStat;
import cn.sumpu.app.guoguojie.domain.DoingSync;
import cn.sumpu.app.guoguojie.domain.DoingTopic;
import cn.sumpu.app.guoguojie.domain.DoingTopicRelation;
import cn.sumpu.app.guoguojie.domain.Ext.DoingExt;
import cn.sumpu.app.guoguojie.domain.Ext.FollowFans;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;

public interface DoingDao {
    public void insert(Doing doing) throws AppBusinessException;

    public void update(Doing doing) throws AppBusinessException;

    public void insertDoingStat(DoingStat doingStat) throws AppBusinessException;

    public void updateViewDoingIP(DoingStat doingStat) throws AppBusinessException;

    public List<Doing> getDoingAll() throws AppBusinessException;

    public Doing getDoingById(String id) throws AppBusinessException;

    public Doing getRootDoingById(String id) throws AppBusinessException;

    public Doing getDoingByMember(String member) throws AppBusinessException; //取得这个会员最后一次发微博的

    public Doing getDoingByFamily(String member) throws AppBusinessException; //取得这个家最后一次发微博的

    public List<Doing> getDoingList(Map<String, Object> map) throws AppBusinessException;

    public int getDoingListCount(Map<String, Object> map) throws AppBusinessException;

    public void deleteDoing(Map<String, Object> map) throws AppBusinessException;

    /**
     * author BruceZhang
     * @param map   
     * 更新微博的量值(+1)
     * @throws AppBusinessException
     */
    public void updateDoingAdd(Map<String, Object> map) throws AppBusinessException;

    public List<DoingExt> getDoingByTopic(Map<String, Object> map) throws AppBusinessException;

    public int getDoingCountByTopic(Map<String, Object> map) throws AppBusinessException;

    public void insertTopic(DoingTopic doingTopic) throws AppBusinessException;

    public void insertTopicRelation(DoingTopicRelation topicRelation) throws AppBusinessException;

    /**
     * 统计匹配关键词的微博数.
     * 
     * @param map
     *            统计条件
     * @return 符合统计条件的微博总数
     * @throws AppBusinessException
     */
    public int countDoingByKeywords(Map<String, Object> map) throws AppBusinessException;

    /**
     * 查询匹配关键词的微博.
     * 
     * @param map
     *            查询条件
     * @return 匹配关键词的微博列表
     * @throws AppBusinessException
     */
    public List<Doing> getDoingByKeywords(Map<String, Object> map) throws AppBusinessException;

    /**
     * author Bruce Zhang
     * @return 取得20个家庭最新的的一条微博
     * @throws AppBusinessException
     */
    public List<Doing> getDoingNewest() throws AppBusinessException;

    /**
     * author Bruce Zhang
     * @param map	参数集合（1.doorplate:门牌号 2.title:图片标题 3.startTime:开始时间 4.endTime:结束时间）
     * @return	根据条件查询微博列表
     * @throws AppBusinessException
     */
    List<Doing> getDoingByCondition(Map<String, Object> map) throws AppBusinessException;

    //根据条件查询微博列表的长度
    int getDoingCountByCondition(Map<String, Object> map) throws AppBusinessException;

    //根据DoingId集合批量屏蔽微博
    void updateByDoingIdList(Map<String, Object> map) throws AppBusinessException;

    //根据DoingId集合批量删除微博
    void deleteByDoingIdList(Map<String, Object> map) throws AppBusinessException;

    //根据微博的标签查询微博
    List<Doing> getDoingListByTag(Map<String, Object> map) throws AppBusinessException;

    //根据微博的标签查询微博总条数
    Integer getDoingCountByTag(Map<String, Object> map) throws AppBusinessException;

    //根据微博的ID取得两条该微博的评论
    List<Comment> getCommentListByDoing(Map<String, Object> map) throws AppBusinessException;

    //根据频道查询商品列表
    List<Doing> getDoingListByChannel(Map<String, Object> map) throws AppBusinessException;

    //根据频道查询商品列表长度
    Integer getDoingCountByChannel(Map<String, Object> map) throws AppBusinessException;

    //童鞋配饰的格子
    List<Doing> getDoingGrid(Map<String, Object> map) throws AppBusinessException;

    //根据频道查询帖子
    List<Doing> getPostsListByChannel(Map<String, Object> map) throws AppBusinessException;

    /**
     * 插入微博商品信息
     * @param doingProduct
     * @throws AppBusinessException
     */
    public void insertDoingProduct(DoingProduct doingProduct) throws AppBusinessException;

    /**
     * 删除微博商品信息
     * @param map
     * @throws AppBusinessException
     */
    public void deleteDoingProduct(Map<String, Object> map) throws AppBusinessException;

    /**
     * 得到微博的商品的信息
     * @param map
     * @return
     * @throws AppBusinessException
     */
    public List<DoingProduct> getDoingProductList(Map<String, Object> map) throws AppBusinessException;

    public int getDoingProductListCount(Map<String, Object> map) throws AppBusinessException;

    /**
     * 插入微博图片信息
     * @param doingProduct
     * @throws AppBusinessException
     */
    public void insertDoingPicture(DoingPicture doingPicture) throws AppBusinessException;

    /**
     * 删除微博图片信息
     * @param map
     * @throws AppBusinessException
     */
    public void deleteDoingPicture(Map<String, Object> map) throws AppBusinessException;

    /**
     * 得到微博的商品的信息
     * @param map
     * @return
     * @throws AppBusinessException
     */
    public List<DoingPicture> getDoingPictureList(Map<String, Object> map) throws AppBusinessException;

    /**
     * 得到关注和粉丝的数量
     * @param map
     * @return
     * @throws AppBusinessException
     */
    public int getFollowCount(Map<String, Object> map) throws AppBusinessException;

    /**
     * 新增关注
     * @param map
     * @throws AppBusinessException
     */
    public void insertFollow(Map<String, Object> map) throws AppBusinessException;

    /**
     * 取消关注或者粉丝
     * @param map
     * @throws AppBusinessException
     */
    public void deleteFollow(Map<String, Object> map) throws AppBusinessException;

    /**
     * 得到我关注的列表
     * @param map
     * @return
     * @throws AppBusinessException
     */
    public List<FollowFans> getFollowList(Map<String, Object> map) throws AppBusinessException;

    /**
     * 得到我的粉丝的列表
     * @param map
     * @return
     * @throws AppBusinessException
     */
    public List<FollowFans> getFansList(Map<String, Object> map) throws AppBusinessException;

    /**
     * 得到我关注的人发的微博列表,包括我自己发的微博
     * @param map
     * @return
     * @throws AppBusinessException
     */
    public List<Doing> getFollowDoingList(Map<String, Object> map) throws AppBusinessException;

    /**
     * 得到我关注的人发的微博的条数
     * @param map
     * @return
     * @throws AppBusinessException
     */
    public int getFollowDoingListCount(Map<String, Object> map) throws AppBusinessException;

    public List<Doing> getDoingListByIds(Map<String, Object> map) throws AppBusinessException;

    public int getDoingListByIdsCount(Map<String, Object> map) throws AppBusinessException;

    public List<Doing> getDoingListByDoingIds(Map<String, Object> map) throws AppBusinessException;

    public int getDoingListByDoingIdsCount(Map<String, Object> map) throws AppBusinessException;

    public List<DoingAudit> getDoingAuditList(Map<String, Object> map) throws AppBusinessException;

    public List<DoingProductAudit> getDoingProductAuditList(Map<String, Object> map) throws AppBusinessException;

    public List<DoingProduct> getProductListByProductIds(Map<String, Object> map) throws AppBusinessException;

    public int getProductListByProductIdsCount(Map<String, Object> map) throws AppBusinessException;

    public int deleteDoingAuditByIds(Map<String, Object> map) throws AppBusinessException;

    public int deleteDoingProductAuditByIds(Map<String, Object> map) throws AppBusinessException;

    public int deleteDoingProductAudit(Map<String, Object> map) throws AppBusinessException;

    public int isFollowMe(Map<String, Object> map) throws AppBusinessException;

    public List<Doing> getDoingByMyFamily(Map<String, Object> map) throws AppBusinessException;//我家发表的

    public int getDoingByMyFamilyCount(Map<String, Object> map) throws AppBusinessException;

    public List<Doing> getMentionByMyFamily(Map<String, Object> map) throws AppBusinessException;//提到我家的

    public int getMentionByMyFamilyCount(Map<String, Object> map) throws AppBusinessException;

    public List<DoingProduct> getOtherLoveDoing(Map<String, Object> map) throws AppBusinessException;//喜欢这个的人还喜欢

    public List<Doing> getForwardDoingList(Map<String, Object> map) throws AppBusinessException;//转发列表

    public int getForwardDoingListCount(Map<String, Object> map) throws AppBusinessException;

    public void updateDoingProduct(DoingProduct doingProduct) throws AppBusinessException;

    public void updateDoingPicture(DoingPicture doingPicture) throws AppBusinessException;

    public List<Doing> getDoingStatList(Map<String, Object> map) throws AppBusinessException;

    public int getDoingStatListCount(Map<String, Object> map) throws AppBusinessException;

    public DoingStat getDoingStatByIp(Map<String, Object> map) throws AppBusinessException;

    //查询这条微博有几个图片
    int getPicCountByDoing(Map<String, Object> map) throws AppBusinessException;

    //查询这条微博有几个商品
    int getProCountByDoing(Map<String, Object> map) throws AppBusinessException;

    //查询这条微博画报号
    String getPictorialByDoing(String doingId) throws AppBusinessException;

    //添加定时微博
    public void insert(DoingSync doingSync) throws AppBusinessException;

    //查询定时微博
    public List<DoingSync> getDoingSync(Map<String, Object> map) throws AppBusinessException;

    //查询定时微博数
    public int getDoingSyncCount(Map<String, Object> map) throws AppBusinessException;

    //删除一条定时微博
    public void deletePostSyncById(String id) throws AppBusinessException;

    //修改一条定时微博
    public void updateDoingSync(DoingSync doingSync) throws AppBusinessException;

    //查询家发的商品数
    public int getDoingProCount(Map<String, Object> map) throws AppBusinessException;

    //查询家发的图片数
    public int getDoingPicCount(Map<String, Object> map) throws AppBusinessException;

    //查询家回帖数
    public int getMyRelpycCount(Map<String, Object> map) throws AppBusinessException;

    //查询家回的帖子的沙发贴
    public List<Doing> getMyRelpy(String family) throws AppBusinessException;

    //查询满足创建5个画报，每个画报内至少添加过一个内容的记录数
    public int getMyPictorialBadge(String family) throws AppBusinessException;

    public DoingProduct getDoingProductById(String id) throws AppBusinessException;

    public DoingPicture getDoingPictureById(String id) throws AppBusinessException;

    /**
     * author BruceZhang
     * @param id	商品ID
     * @return	根据商品Id查询产品的所有属性
     * @throws AppBusinessException
     */
    DoingProduct getDpById(String id) throws AppBusinessException;

    /**
     * author BruceZhang
     * @param map	startTime：开始时间 endTime：结束时间 pictorial：所属画报
     * @return	查询画报的商品(后台ETAO)
     * @throws AppBusinessException
     */
    List<DoingProduct> getProductByPictorial(Map<String, Object> map) throws AppBusinessException;

    /**
     * author Bruce Zhang
     * @param map from：来源  originalId：原始ID
     * @return 查询这个商品是否被分享过
     * @throws AppBusinessException
     */
    DoingProduct getProductContain(Map<String, Object> map) throws AppBusinessException;

    /**
     * author Bruce Zhang
     * @param map from：来源  originalIds：原始ID集合
     * @return 查询这些商品是否被分享过
     * @throws AppBusinessException
     */
    List<DoingProduct> getProductsContain(Map<String, Object> map) throws AppBusinessException;

    /**
     * @author nick
     * @param doingProductTime
     * @throws AppBusinessException
     */
    void insertDoingProductTime(DoingProductTime doingProductTime) throws AppBusinessException;

    /**
     * @author nick
     * @param map
     * @return
     * @throws AppBusinessException
     */
    DoingProductTime getDoingProductTime(Map<String, Object> map) throws AppBusinessException;

    List<DoingProductTime> getFanliProduct(Map<String, Object> map) throws AppBusinessException;

    int getFanliProductCount(Map<String, Object> map) throws AppBusinessException;

    /**
     * 查看指定的产品当前是否正在做返利活动.
     * 
     * @param productId
     * @return
     * @throws AppBusinessException
     */
    public DoingProductTime getHasProductTime(String productId) throws AppBusinessException;

    //查询微博
    List<Doing> getDoingBruce(Map<String, Object> map) throws AppBusinessException;

    //查询商品
    List<DoingProduct> getProductBruce(Map<String, Object> map) throws AppBusinessException;

}
